package com.gwz.sys.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.gwz.sys.service.LogInfoService;
import com.gwz.sys.utils.DataGridView;
import com.gwz.sys.utils.ResultObj;
import com.gwz.sys.vo.LogInfoVo;

@RestController
@RequestMapping("loginfo")
public class LogInfoController {
	
	@Autowired
	private LogInfoService logInfoService;
	
	
	@RequestMapping("loadAllLogInfo")
	public DataGridView loadAllLogInfo(LogInfoVo infoVo) {
		return logInfoService.queryAllLogInfo(infoVo);
	}
	
	@RequestMapping("deleteLogInfo")
	public ResultObj deleteLogInfo(LogInfoVo logInfoVo) {
		ResultObj resultObj = new ResultObj(200, "删除成功");
		try {
			logInfoService.deleteLogInfo(logInfoVo);
			return resultObj;
		} catch (Exception e) {
			resultObj.setCode(-1);
			resultObj.setMsg("删除失败");
			e.printStackTrace();
			return resultObj;
		}
	}
	
	@RequestMapping("batchDelete")
	public ResultObj batchDelete(LogInfoVo logInfoVo) {
		ResultObj resultObj = new ResultObj(200, "删除成功");
		try {
			logInfoService.batchDelete(logInfoVo);
			return resultObj;
		} catch (Exception e) {
			resultObj.setCode(-1);
			resultObj.setMsg("删除失败");
			e.printStackTrace();
			return resultObj;
		}
	}
}
